package test;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Anwendung extends javax.swing.JFrame {
	private JButton jButton1;
	private JPanel jPanel1;
	private JButton jButton2;
	
	private AnwesenheitPanel anwesenheitsPanel;
	private AdminPanel adminPanel;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				Anwendung inst = new Anwendung();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public Anwendung() {
		super();
		initGUI();
		hideAll();
		
	}
	
	private void hideAll() {
		anwesenheitsPanel.setVisible(false);
		adminPanel.setVisible(false);
		
	}

	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				jButton1 = new JButton();
				getContentPane().add(jButton1);
				jButton1.setText("Anwesenheit");
				jButton1.setBounds(92, 18, 138, 21);
				jButton1.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						jButton1ActionPerformed(evt);
					}
				});
			}
			{
				jButton2 = new JButton();
				getContentPane().add(jButton2);
				jButton2.setText("Admin");
				jButton2.setBounds(267, 18, 138, 21);
				jButton2.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						jButton2ActionPerformed(evt);
					}
				});
			}
			{
				anwesenheitsPanel = new AnwesenheitPanel();
				getContentPane().add(anwesenheitsPanel);
				anwesenheitsPanel.setBounds(15, 65, 606, 543);
				
				
				adminPanel=new AdminPanel();
				getContentPane().add(adminPanel);
				adminPanel.setBounds(15, 65, 606, 543);
				
			}
			pack();
			this.setSize(684, 547);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	private void jButton1ActionPerformed(ActionEvent evt) {
		hideAll();
		anwesenheitsPanel.setVisible(true);
	}
	
	private void jButton2ActionPerformed(ActionEvent evt) {
		hideAll();
		adminPanel.setVisible(true);
	}

}
